<?php
require "BL/booking.php";

    $blo= new Booking();
    if($bookings=$blo->getAllBookingRequest()):
//            echo "<pre>";
//            print_r($bookings);
//            die();
        //chekcing if result array has more than one result.
            if(!is_array($bookings[0])):
?>
<!--                Output for one result array-->
                    <div id="booking-list">
                        <pre>
                    <?php foreach($bookings as $key=>$value): ?>
                            <span><?php echo str_replace("_", " ", $key).":".$value; ?></span>
                          <?php  endforeach;  ?>
                           <input type="button" id="accept-booking" name="accept-booking" value="Accept Request"  onclick="acceptRequest(<?php echo $bookings['booking_id'];?>)">
                        </pre>
                    </div>

      <?php else: ?>
<!--                output for multiple result-->
                <div id="booking-list">
                 
                    <?php
                    foreach($bookings as $booking):
                      echo "<pre>";
                        foreach($booking as $key=>$value):?>
                            <span><?php echo str_replace("_", " ", $key).":".$value; ?></span>
                            
                         <?php endforeach;?>
                            <input type="button" id="accept-booking" name="accept-booking" value="Accept Request"  onclick="acceptRequest(<?php echo $booking['booking_id'];?>)">
                        </pre>
                    <?php endforeach; ?>


                    </div>
      <?php endif; ?>

<?php
    else:
?>
<div id="no-data-found"">
       No Booking found.
</div>
<?php
    endif;
?>
